package com.TestDemo.cloneTest;

public class TestClone {
    public static void main(String[] args) {
        Student st1 = new Student();
        st1.setAge(22);
        st1.setName("zjz");
        Student st2 = (Student)st1.clone();
        System.out.println("学生1:" + st1.getName()); // 学生1:zjz
        System.out.println("学生2:" + st2.getName()); // 学生2:zjz

        st2.setName("hh");
        System.out.println("学生2改:" + st2.getName()); // 学生2改:hh
        System.out.println("学生1:" + st1.getName()); // 学生1:zjz

        System.out.println("st1==st2:"+ (st1==st2)); // st1==st2:false

    }
}
